import 'dart:async';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
// import 'package:video_player/video_player.dart';

class SplashScreen extends StatefulWidget {
  @override
  _SplashScreenState createState() => _SplashScreenState();
}

class _SplashScreenState extends State<SplashScreen> {
  // late VideoPlayerController _controller;
  // final RxBool _isInitialized = false.obs;

  // late Future<void> _initializeVideoPlayerFuture;


  @override
  void initState() {
    super.initState();

    //   _controller = VideoPlayerController.networkUrl(Uri.parse('https://osg.gonghai.top/video/kaiping.mp4'))
    //    ..initialize().then((_) {
    //     _controller.setVolume(0.0);
    //       _isInitialized.value = true;
    //       _controller.play(); // 初始化完成后立即播放
    //       _controller.setLooping(false); // 如果需要循环播放
    //   }).then((_) {
    //   // 视频播放完成后跳转
    //   _controller.addListener(() {
    //     if (_controller.value.isInitialized && !_controller.value.isPlaying && _controller.value.position == _controller.value.duration) {
    //        Get.offNamed('/');
    //     }
    //   });
    // }).catchError((onError){
    //   print('tttttttt');
    //   print(onError);
    // });
    WidgetsBinding.instance.addPostFrameCallback((_) {
            Timer(Duration(seconds: 3), () {
          Get.offAllNamed('/');
      });
  
    });
  
  }

  @override
  void dispose() {
    // _controller.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Color(0XFF000000),
      body:  
      Center(
        child: Image.asset('static/video/dong.gif')
        
        )
      
      // Obx(()=>
      //   Center(
      //     child: _isInitialized.value
      //         ? AspectRatio(
      //             aspectRatio: _controller.value.aspectRatio,
      //             child: VideoPlayer(_controller),
      //           )
      //         : CircularProgressIndicator(),
      //   )
      // ),
    
    );
  }
}
